import React, { Component } from 'react';
import DataChart from '../dataChart'
import DataTable from '../dataTable'
import ProductStocksIndex from '@/services/models/ProductStocksIndex'

class ProdChart extends Component {
  constructor(props) {
    super(props);

    this.state = {
      list: [1, 2, 3],
      series: []
    }
    this.fetchData = this.fetchData.bind(this)
  }
  async fetchData(params) {
    let res = await ProductStocksIndex.findAll(params)
    this.setState({
      series: [res, res]
    })
  }
  componentWillMount() {
    this.fetchData({typeId: '1'})
  }
  render () {
    return (
      <div className="prodChart">
        <DataChart desc="累计" series={this.state.series}></DataChart>
        <DataTable list={this.state.list}></DataTable>
      </div>
    )
  }
}

export default ProdChart;